package com.hq.service;

import com.hq.bean.Product;
import com.hq.bean.Users;
import com.hq.dao.ProductDao;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class ProductServiceImpl implements ProductService{
    @Resource
    private ProductDao productDao;
    @Override
    public List list(Map map) {
        return productDao.list(map);
    }

    @Override
    public List baseList() {
        return productDao.baseList();
    }


    @Override
    public int add(Product product, Integer[] bids) {
        //单添
        int i = productDao.add(product);
        //添加中间
        if (bids!=null && bids.length>0){
            Map map = new HashMap();
            map.put("pid",product.getPid());
            map.put("bids",bids);
            productDao.addzhong(map);
        }
        return i;
    }

    @Override
    public Users login(Users users) {
        return productDao.login(users);
    }
}
